angular.module('app.event')

    .factory('eventService', ["$http", "config", function ($http, config) {

        var baseUrl = config.baseUrl;

        var ret = {};

        ret.eventList=function(query){
            var url=baseUrl+"/events";
            return $http.get(url, {params:query});
        };

        ret.addEvent=function(eventDetail){
            var url=baseUrl+"/events";
            return $http.post(url, eventDetail);
        };

        ret.updateEvent=function(eventDetail){
            var url=baseUrl+"/events/"+eventDetail.id;
            return $http.post(url, eventDetail);
        };

        ret.deleteEvent=function(eventDetail){
            var url=baseUrl+"/events/"+eventDetail.id;
            return $http.delete(url, eventDetail);
        };


        //消费记录
        ret.orderRecordsList=function(query){
            var url=baseUrl+"/orders";
            return $http.get(url, {params:query});
        };
        return ret;
    }]);